<?php 


require '../dao/saishidao.php';
$saishiid=$_GET['saishiid'];//获取到要查询的赛事的id
//$saishi=$_GET['saishi'];//获取到要增加的赛事的内容
$delid=$_GET['delid'];//获取到要删除的赛事的id
$dao=new saishidao();
$saishidel=$dao->Del($delid);//删除赛事
$saishilist=$dao->Chaxun($saishiid);//查询id

//print  $saishidel;
if(empty($saishilist)) {
	$info="赛事不存在";
}
if(empty($_POST['saishi'])){
	$infoo= "请输入";
}
?>
<form action="../controller/handout.php?con=saishi&action=saishiquery" method="post">
<label>赛事id或内容：</label>
<input type="text" name="saishiid"/>
<input type="submit"  value="查询"/>
</form>

<table class="tab">
<tr>
	<td>赛事ID</td>
	<td>赛事内容</td>
	<td>图片</td>
	<td>发表时间</td>
	<td>删除赛事</td>
</tr>
<?php if(!empty($info)){echo $info;}
 foreach ($saishilist as $gamer){ ?>
 <tr>
	<?php foreach ($gamer as $i=>$value){
	if($value=="del"){?>
       <td><a href="main.php?url=saishi.php&delid=<?php echo $gamer['id']?>">删除</a></td>    
	<?php }
	 else {  ?><td><?php 
if ($i=='img'){
if(strpos($value,"/")!=false){
echo "<img src='../../qian/".$value."'/>";
}else
echo "<img src='../view/img.php?src=".$value."'/>";
}
   else {echo $value; }	
	}?></td>
	<?php } ?>
</tr>
<?php }?>
</table>
<form  action="../controller/handout.php?con=saishi&action=saishitian" enctype="multipart/form-data" method="post">
<label>添加赛事：</label>
<textarea name="saishi" rows="5" cols="20"></textarea>
<input type="file" name="file"  value="上传图片"/> 
<input type="submit"  value="添加"/>

</form>
<?php  if(!empty($infoo)){echo $infoo;}
?>